<?php

class Application_Model_RaceTbl  extends Zend_Db_Table_Abstract
{
	protected $_name = 'race';
	
	function getRacesByClass($class_fk)
    {
        $select = $this->_db->select()
                            ->from($this->_name, array('name', 'class_fk'))
                            ->where('class_fk=?',$class_fk);
                            
        $result = $this->getAdapter()->fetchAll($select);
        
    	return $result;
    }
    
	function getRaceIDByRaceName($race_name)
    {
        $select = $this->_db->select()
                            ->from($this->_name, array('id', 'name', 'class_fk'))
                            ->where('name=?',$race_name);
                            
        $result = $this->getAdapter()->fetchRow($select);
        
    	return $result;
    }
    
	function getRaceNameByRaceID($race_id)
    {
        $select = $this->_db->select()
                            ->from($this->_name, array('id', 'name'))
                            ->where('id=?',$race_id);
                            
        $result = $this->getAdapter()->fetchRow($select);
        
    	return $result;
    }
}

